package org.yzh.scheduler.model.entity;

import io.swagger.annotations.ApiModelProperty;
import org.yzh.scheduler.model.enums.Role;

import java.time.LocalDateTime;

public class UserDO {

    @ApiModelProperty("用户名")
    private Integer id;

    @ApiModelProperty("密码")
    private String password;

    @ApiModelProperty("角色(1.管理员 2.普通用户)")
    private Role role;

    @ApiModelProperty("创建时间")
    private LocalDateTime createdAt;

    public UserDO() {
    }

    public UserDO(Integer id, String password) {
        this.id = id;
        this.password = password;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserDO other = (UserDO) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        return result;
    }
}